package cn.hnevc.lirihui;

import java.util.Arrays;

public class WrapperTest {
private static final String SPACE_SEPARATOR = " ";
public static void main(String[] args) {
	String numStr = "20 78 9 -7 88 36 29";
	System.out.println(numStr);
	numStr = sortSringNumber(numStr);
	System.out.println(numStr.toString());
	
}
private static String sortSringNumber(String numStr) {
	String[] str_arr =stringToArray(numStr);
	int [] num_arr = toIntArray(str_arr);
	mySortArray(num_arr);
	String temp  = arrayToString(num_arr);
	// TODO Auto-generated method stub
	return temp;
}
private static String arrayToString(int[] num_arr) {
	StringBuffer sb = new StringBuffer();
	for (int x = 0; x < num_arr.length; x++) {
	if (x != num_arr.length - 1) {
		sb.append(num_arr[x] + SPACE_SEPARATOR);
		
	} else {
		sb.append(num_arr[x]);

	}
		
	}
	// TODO Auto-generated method stub
	return sb.toString();
}
private static void mySortArray(int[] num_arr) {
	Arrays.sort(num_arr);
	// TODO Auto-generated method stub
	
}
private static int[] toIntArray(String[] str_arr) {
	int[] arr = new int[str_arr.length];
	for (int i = 0; i < arr.length; i++) {
		arr[i] = Integer.parseInt(str_arr[i]);
	}
	// TODO Auto-generated method stub
	return arr;
}
private static String[] stringToArray(String numStr) {
	String[] str_arr =numStr.split(SPACE_SEPARATOR);
	// TODO Auto-generated method stub
	return str_arr;
}
}
